import type{ getClassReturn,updateClassReturn  } from "./type"
//统一管理用户相关的接口

//引入封装好的axios
import request from "@/utils/request"
//引入登录成功后返回信息的类型
enum API{
   
    GETMAINCLASS_URL = "/course/compulsory/?",
    ADDCLASS_URL = "/course",
    DELCLASS_URL = "/course/?",
    EDICLASS_URL = "/course",
    GETCOMMONCLASS_URL = "/course/elective/?"

}
export const getMainClass = (page:number,pageSize:number)=>{
   
    return request.get<any,getClassReturn>(API.GETMAINCLASS_URL+`page=${page}&pageSize=${pageSize}`)
}
export const addClass  = (data:any)=>{
   
    return request.post<any,updateClassReturn>(API.ADDCLASS_URL,data)
}
export const delClass = (data:any)=>{
    
    return request.delete<any,updateClassReturn>(API.DELCLASS_URL+`id=${data}`)
}
export const editClass = (data:any)=>{
    return request.patch<any,updateClassReturn>(API. EDICLASS_URL,data)
}
export const getCommonClass = (page:number,pageSize:number)=>{
    return request.get<any,getClassReturn>(API.GETCOMMONCLASS_URL+`page=${page}&pageSize=${pageSize}`)
}